﻿@{
    ViewBag.Title = "查看表结构信息";
    Layout = "~/Views/Shared/_Main.cshtml";
}
@section Head{}
<script type="text/javascript">
    var UrlArray = $.getUrlArray();
    var opts = {
        height: 360,
        rows: 1000,
        para: { tableName: UrlArray["tableName"], modelID: UrlArray["modelID"], version: UrlArray["version"], dbName: encodeURI(UrlArray["dbName"]) },
        url: '/ODSConfig/GetTableInfo',
        columns: [
                      { field: 'ColumnName', title: '列名', width: 20 },
                      { field: 'ColumnTypeSource', title: '数据类型', width: 15, align: 'center' },
                      { field: 'Length', title: '长度', width: 10, align: 'center' },
                      { field: 'Precision', title: '精度', width: 10, align: 'center' },
                      { field: 'DecimalPlaces', title: '小数位', width: 10, align: 'center' },
                      { field: 'PK', title: '主键', width: 10, align: 'center', formatter: function (value) { return value == "1" || value == "是" ? "是" : "否"; } },
                      { field: 'IsNull', title: '允许空', width: 10, align: 'center', formatter: function (value) { return value == "1" || value == "是" ? "是" : "否"; } },
                      { field: 'Desc', title: '说明', width: 20, align: 'center' }
                    ]
    };
    $(function () {
        if (UrlArray["edit"] == 1) {
            $("#tbedit").show();
            opts.columns = [
                      { field: 'ColumnName', title: '列名', width: 20 },
                      { field: 'ColumnTypeSource', title: '数据类型', width: 15, align: 'center' },
                      { field: 'PK', title: '主键', width: 10, align: 'center', formatter: function (value) { return value == "1" || value == "是" ? "是" : "否"; } },
                      { field: 'Desc', title: '说明', width: 20, align: 'center', formatter: function (value, rowData, rowIndex) {
                          return "<input type='text' id='txt" + rowData.GUID + "' >";
                      }
                      }
                    ];
        }
        if (UrlArray["tableName"])
            $("#tbName").html('[' + UrlArray["tbName"] + '] 表详细信息');
        if (UrlArray["modelID"])
            $("#tbName").html('[' + UrlArray["tbName"] + '] 模型详细信息');

        $("#stagingdbTableInfo").dg(opts);
    });
    function save() {
        var retArr = jv.GetDivJson($("#stagingdbTableInfo"), 3);
        returnParent(retArr);
        return false;
    }
</script>
<div style="height: 470px; padding-left: 5px; padding-right: 5px; overflow-y: scroll;">
    <table class="listTitle">
        <tr>
            <td width="15">
                <img src="/images/edit.png" />
            </td>
            <td>
                <span id="tbName"></span>
            </td>
            <td>
                <div id="tbedit" style="display: none; text-align: right">
                    <input type="button" class="button" value=" 保存 " onclick="save()" />
                </div>
            </td>
        </tr>
    </table>
    <table id="stagingdbTableInfo" class="pagTable" cellpadding="0" cellspacing="0">
    </table>
    <div id="loading" class="loading">
        <img src="/Images/tree_loading.gif" />
    </div>
</div>
